package org.zfes.snowier.common.monitor.jvm.server;

import org.zfes.snowier.common.monitor.utils.Arith;

/**
 * CPU相关信息
 * 
 * @author ruoyi
 */
public class Cpu {
	/**
	 * 核心数
	 */
	private int cpuNum;

	/**
	 * CPU总的使用率
	 */
	private String total;

	/**
	 * CPU系统使用率
	 */
	private String sys;

	/**
	 * CPU用户使用率
	 */
	private String used;

	/**
	 * CPU当前等待率
	 */
	private String wait;

	/**
	 * CPU当前空闲率
	 */
	private String free;

	public int getCpuNum() {
		return cpuNum;
	}

	public void setCpuNum(int cpuNum) {
		this.cpuNum = cpuNum;
	}

	public String getTotal() {
		return String.valueOf(Arith.round(Arith.mul(Double.valueOf(total), 100), 2));
	}

	public void setTotal(String total) {
		this.total = total;
	}

	public String getSys() {
		return String.valueOf(Arith.round(Arith.mul(Double.valueOf(sys) / Double.valueOf(total), 100), 2));
	}

	public void setSys(String sys) {
		this.sys = sys;
	}

	public String getUsed() {
		return String.valueOf(Arith.round(Arith.mul(Double.valueOf(used) /Double.valueOf(total) , 100), 2));
	}

	public void setUsed(String used) {
		this.used = used;
	}

	public String getWait() {
		return String.valueOf(Arith.round(Arith.mul(Double.valueOf(wait) /Double.valueOf(total) , 100), 2));
	}

	public void setWait(String wait) {
		this.wait = wait;
	}

	public String getFree() {
		return String.valueOf(Arith.round(Arith.mul(Double.valueOf(free) /Double.valueOf(total) , 100), 2));
	}

	public void setFree(String free) {
		this.free = free;
	}

	@Override
	public String toString() {
		return "Cpu [cpuNum=" + cpuNum + ", total=" + total + ", sys=" + sys
				+ ", used=" + used + ", wait=" + wait + ", free=" + free + "]";
	}

}
